<?php if (!$page): ?>
    <article id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
    <?php endif; ?>
<?
    $breadcrumb=drupal_get_breadcrumb();
    $breadcrumb[]=l('Места','places');
   $results = db_query('SELECT tid FROM {taxonomy_index} WHERE nid = :nid', array(':nid' => $node->nid));
        foreach ($results as $result) {
          $term = taxonomy_term_load($result->tid);
          if($term->vid==5){$breadcrumb[]=l($term->name,'places',array('query'=>array('category'=>$term->tid)));break;}
        }
   $breadcrumb[]='<strong>'.$node->title.'</strong>';
   echo "<div class='breadcrumb'>".implode(" &raquo; ",$breadcrumb)."</div>";
   
   $nodes = get_places_by_brand($node->field_place_brand['und'][0]['nid']);
    
    ?>
    <h1 class="title"><?php print $node->title; ?></h1>
    
    <div class="place_area">
<div class="events_in_place">
<h3 class="active_tab tab_info" onClick="sw_placenode('info')">Информация</h3> 
 <?php if (isset($content['field_place_images']['#items']) && count($content['field_place_images']['#items'])) : ?>
<h3 class="tab_gallery" onClick="sw_placenode('gallery')">Галереи</h3>
<?endif;?>
 <h3 class="tab_description" onClick="sw_placenode('description')">Описание</h3>
 <?if(count($nodes) > 1 ):?><h3 class="tab_other_places" onClick="sw_placenode('other_places')">Другие заведения</h3><?endif;?>
  <!-- <h3 class="tab_comments" onClick="sw_placenode('comments')">Комментарии</h3> -->
 </div>
		<div class="info_thumb">

		<?php if (isset($content['field_place_thumbnail']['#items']) && count($content['field_place_thumbnail']['#items'])) : ?>
			<?php foreach ($content['field_place_thumbnail']['#items'] as $i) : ?>
				<div class="thumb"><img src="<?php echo image_style_url('220x220', $i['uri']); ?>"  title="<?=$node->title;?>" alt="<?=$node->title;?>"/></div>
			<?php endforeach; ?>
		<?php else : ?>
			<div class="thumb"></div>
		<?php endif; ?>

		<div class="info">
        <table class="short_info">

            <tr>
                <td class="short_info_label">
                    Категория:
                </td>
                <td>
                    <?php foreach ($content['field_place_category']['#items'] as $c) : ?>
                        <a href="/places?category=<?php echo $c['taxonomy_term']->tid; ?>"><?php echo $c['taxonomy_term']->name; ?></a>&nbsp;&nbsp;
                    <?php endforeach; ?>
                </td>
            </tr>
            <tr>
                <td class="short_info_label">
                    Город:
                </td>
                <td>
                    <a href="<?php echo get_city_url_by_id($node->field_place_city['und'][0]['tid']) ; ?>"> <?php echo $node->field_place_city['und'][0]['taxonomy_term']->name; ?></a>
                </td>
            </tr>
            <?php if (isset($content['field_place_address']['#items'][0]['value'])) : ?>
            <tr>
                <td class="short_info_label">
                    Адрес:
                </td>
                <td>
                    <?php echo nl2br($content['field_place_address']['#items'][0]['value']); ?>
                </td>
            </tr>
            <?php endif; ?>

            <?php if (isset($content['field_place_phone']['#items'][0]['value'])) : ?>
            <tr>
                <td>
                    Телефон:
                </td>
                <td>
                    <?php echo $content['field_place_phone']['#items'][0]['value']; ?>
                </td>
            </tr>
            <?php endif; ?>

            <?php if (isset($content['field_place_website']['#items'][0]['value'])) : ?>
            <tr>
                <td>
                    Сайт:
                </td>
                <td>
                <?php if (isset($content['field_place_active_link']['#items'][0]['value']) && $content['field_place_active_link']['#items'][0]['value'] == 1) : ?>

                    <?php $place_website = $content['field_place_website']['#items'][0]['value']; ?>
                    <?php $place_website = str_replace("http://", '', $place_website); ?>

                    <a target="_blank" href="http://<?php echo $place_website ?>"><?php echo $place_website ?></a>

                <?php else : ?>
                <?php echo $content['field_place_website']['#items'][0]['value']; ?>
                <?php endif; ?>
                </td>
            </tr>
            <?php endif; ?>
            <tr>
                <td colspan="2" class="error_claim">
                    <a href="mailto:web@spreklama.com.ua?subject=Ошибка на сайте">Ошибка?</a> | <a href="mailto:web@spreklama.com.ua?subject=Предложение">Вы владелец заведения, у нас к вам дело</a>
                </td>
            </tr>
        </table>
		</div>
		</div>
       <!--div class="full_content"-->

        
        <div class="gallery_list_wrapper">
		<?php if (isset($content['field_place_images']['#items']) && count($content['field_place_images']['#items'])) : ?>
            <?php foreach ($content['field_place_images']['#items'] as $i) : ?>
                <a class="fancybox" rel="gallery" href="<?php echo image_style_url('large', $i['uri']); ?>" title="<?php echo htmlspecialchars($i['title']) ?>"><img src="<?php echo image_style_url('large', $i['uri']); ?>" /></a>
            <?php endforeach; ?>

            <br /><br />

        <?php endif; ?>
        <?php $gallery_package_array = get_gallery_package_by_node_id($node->nid);?>
        <?php
        foreach ($gallery_package_array as $gallery_package_id) :?>
        <?php $gallerys_list = get_gallery_liste_by_package_id($gallery_package_id->tid);?>
        <?php
         foreach ($gallerys_list as $gallery) :

            $image_list = get_img_list_by_gallery_id($gallery->nid);?>

            <script>

            jQuery(function () {

			jQuery("#gallery_<?php echo $gallery->nid;?>").click(function() {
				jQuery.fancybox.open([

                <?php foreach ($image_list as $image) :  ?>
                
                                                {
                                                    scrolling : 'auto',
                                                    tpl: {
                                                    wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><table class="img_comments"><tr><td><div class="fancybox-inner"></div></td><td class="commentsblocktd"><div class="commentsblock"><iframe src="http://www.facebook.com/plugins/comments.php?href=http://infopark.com.ua/sites/default/files/styles/media_gallery_large/public/<?php echo substr($image->uri, 9); ?>" scrolling="no" frameborder="0" style="border:none; width:100%;  height:230px"></iframe></div></td></tr></table></div></div></div>'
                                                    },
                                                    'href'	: 'http://infopark.com.ua/sites/default/files/styles/media_gallery_large/public/<?php echo substr($image->uri, 9); ?>',
                                                    'title'	: '<?php echo $image->media_title_value; ?>',
                                                    wrapCSS: "gallery_css_class"
                                                },
                
                
                               <?php  endforeach; ?>

               				], {
					helpers : {
						thumbs : {
							width: 75,
							height: 50
						}
					}
				});
			});

                });
             </script>
             <?php
                endforeach;

        ?>

        <?php foreach ($gallerys_list as $gallery) :

              echo gallery_view_prev($gallery->nid);

              endforeach;
		?>

		<?php
              endforeach;
        ?>
       </div>
	   <div class="placedescription">
        <?php if (isset($content['field_place_description']['#items'][0]['value'])) : ?>
            <?php echo nl2br($content['field_place_description']['#items'][0]['value']); ?>
        <?php endif; ?>
		</div>
       
     <?php if(count($nodes) > 1 ):?>  
       <div class="other_places places_related_by_brend" style="display:none">
        <?php foreach ($nodes as $n)if ($n->status == 1) echo l($n->title, 'node/' . $n->nid).' ';?>
       </div>
         <?php endif; ?>
       
       
       <?php if (user_access('bypass node access')) : ?>
            <div class="admin-link">
            <?php echo l('Редактировать', 'node/' . $node->nid . '/edit'); ?>
            </div>
        <?php endif; ?>


        <?php/* $nodes = get_places_by_brand($node->field_place_brand['und'][0]['nid']); ?>
        <?php if (isset($nodes)) : ?>
            <div class ="places_related_by_brend">
            <br/>
            <?php if(count($nodes) > 1 ):?>
            <h2>Другие заведения сети</h2>
            <?php endif; ?>
            <?php foreach ($nodes as $n) : ?>
                <?php if ($n->status == 1) : ?>

                    <?php echo l($n->title, 'node/' . $n->nid).' '; ?>
                <?php endif; ?>
            <?php endforeach; ?>
            </div>
        <?php endif;*/ ?>


       <div class="clearfix share">
           <div class="pull-right">
		<?=social_plugings();?>
		<!--/div-->
           </div>      
       </div>	

    </div>
<?
#sites/modules/advert/advert_compromise.inc
#echo _fb_vk_comments();
?>
<script type="text/javascript">
jQuery('.placedescription').hide();
jQuery('.comments').hide();
jQuery('.gallery_list_wrapper').hide();
</script>
<?php if (!$page): ?>
    </article>
<?php endif; ?>